﻿using FluentNHibernate.Conventions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentNHibernate.Conventions.AcceptanceCriteria;
using FluentNHibernate.Conventions.Inspections;
using FluentNHibernate.Conventions.Instances;

namespace OneStationFile.DAL
{
    public class EnumConvention : IUserTypeConvention
    {
        public void Apply(IPropertyInstance instance)
        {
            instance.CustomType(instance.Property.PropertyType);
        }

        public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
        {
            criteria.Expect(x => x.Property.PropertyType.IsEnum);
        }
        public bool Accept(Type type)
        {
            return type.IsEnum;
        }

        //public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
        //{
        //    throw new NotImplementedException();
        //}

        //public void Apply(IPropertyInstance instance)
        //{
        //    throw new NotImplementedException();
        //}
    }
}
